// run: $exec < input
#include <iostream>

long long a, b;

int get_len(long long a)
{
	int ret = 0;
	for (; a; a /= 2) ret++;
	return ret;
}

int count_greater(long long x)
{
	int l = 0;
	for (int i = 0; x; x /= 2, i++) {
		if (!(x & 1)) l = i;
	}
	return l + 1;
}

int count_less(long long x)
{
	int l = 0, i = 0, count = 0;
	for (; x; x /= 2, i++) {
		if (!(x & 1)) l = i, count++;
	}
	int ret = i - l - 2;
	if (count == 1) ret++;
	return ret;
}

int main()
{
	std::cin >> a >> b;
	int l1 = get_len(a);
	int l2 = get_len(b);
	int ans = 0;
	for (int i = l1 + 1; i < l2; i++)
		ans += i - 1;
	int tmp = count_greater(a);
//	std::cout << "> a  = " << tmp << '\n';
	tmp += count_less(b);
//	std::cout << "< b  = " << count_less(b) << '\n';
	if (l1 == l2) ans += tmp - l1 + 1;
	else ans += tmp;
	std::cout << ans << '\n';
}

